
#ifndef dex_structs_h
#define dex_structs_h
#include "dex-types.h"
	
class CDexEncodedArray;
class CDexEncodedAnnotation;
class CDexAnnotationElement;
class CDexHeaderItem;
class CDexMapList;
class CDexMapItem;
class CDexStringidItem;
class CDexStringdataItem;
class CDexTypeidItem;
class CDexProtoidItem;
class CDexFieldidItem;
class CDexMethodidItem;
class CDexClassdefItem;
class CDexClassdataItem;
class CDexEncodedField;
class CDexEncodedMethod;
class CDexTypeList;
class CDexTypeItem;
class CDexCodeItem;
class CDexTryItem;
class CDexEncodedcatchhandlerList;
class CDexEncodedcatchHandler;
class CDexEncodedtypeaddrPair;
class CDexDebuginfoitemHeader;
class CDexAnnotationsdirectoryItem;
class CDexFieldAnnotation;
class CDexMethodAnnotation;
class CDexParameterAnnotation;
class CDexAnnotationsetrefList;
class CDexAnnotationsetrefItem;
class CDexAnnotationoffItem;
class CDexAnnotationItem;
class CDexEncodedarrayItem;
class CDexDalvikannotationAnnotationDefault;
class CDexDalvikannotationEnclosingclass;
class CDexDalvikannotationEnclosingmethod;
class CDexDalvikannotationInnerclass;
class CDexDalvikannotationMemberclasses;
class CDexDalvikannotationSignature;
class CDexDalvikannotationThrows;
class CDexClass;
class CDexAnnotation;
class CDexMethod;
class CDexString;
class CDexEncodedValue;
class CDexEncodedArray
{

	char dummy;

public:
/*
	//number of elements in the array
	CDexUleb128 size;
	//"a series of size encoded_value byte sequences in the format specified by this section, concatenated sequentially."
	CDexEncodedValue values[size];
*/
	//number of elements in the array
	unsigned int GetSize();
	//"a series of size encoded_value byte sequences in the format specified by this section, concatenated sequentially."
	CDexEncodedValue* GetValues();

	int Size();
	void print();
	int sprint(char *buffer);	
};
class CDexEncodedAnnotation
{

	char dummy;

public:
/*
	//type of the annotation. This must be a class (not array or primitive) type.
	CDexUleb128 type_idx;
	//number of name-value mappings in this annotation
	CDexUleb128 size;
	//elements of the annotataion, represented directly in-line (not as offsets). Elements must be sorted in increasing order by string_id index.
	CDexAnnotationElement elements[size];
*/
	//type of the annotation. This must be a class (not array or primitive) type.
	unsigned int GetTypeIdx();
	//number of name-value mappings in this annotation
	unsigned int GetSize();
	//elements of the annotataion, represented directly in-line (not as offsets). Elements must be sorted in increasing order by string_id index.
	CDexAnnotationElement* GetElements();

	int Size();
	void print();
	int sprint(char *buffer);	
};
class CDexAnnotationElement
{

	char dummy;

public:
/*
	//element name, represented as an index into the string_ids section. The string must conform to the syntax for MemberName, defined above.
	CDexUleb128 name_idx;
	//element value
	CDexEncodedValue value;
*/
	//element name, represented as an index into the string_ids section. The string must conform to the syntax for MemberName, defined above.
	unsigned int GetNameIdx();
	//element value
	CDexEncodedValue* GetValue();

	int Size();
	void print();
	int sprint(char *buffer);	
};
class CDexHeaderItem
{


public:
	//"magic value. See discussion above under ""DEX_FILE_MAGIC"" for more details."(= DEX_FILE_MAGIC)
	ubyte magic[8];
	//adler32 checksum of the rest of the file (everything but magic and this field); used to detect file corruption
	uint checksum;
	//"SHA-1 signature (hash) of the rest of the file (everything but magic, checksum, and this field); used to uniquely identify files"
	ubyte signature[20];
	//"size of the entire file (including the header), in bytes"
	uint file_size;
	//"size of the header (this entire section), in bytes. This allows for at least a limited amount of backwards/forwards compatibility without invalidating the format."(= 0x70)
	uint header_size;
	//"endianness tag. See discussion above under ""ENDIAN_CONSTANT and REVERSE_ENDIAN_CONSTANT"" for more details."(= ENDIAN_CONSTANT)
	uint endian_tag;
	//"size of the link section, or 0 if this file isn't statically linked"
	uint link_size;
	//"offset from the start of the file to the link section, or 0 if link_size == 0. The offset, if non-zero, should be to an offset into the link_data section. The format of the data pointed at is left unspecified by this document; this header field (and the previous) are left as hooks for use by runtime implementations."
	uint link_off;
	//"offset from the start of the file to the map item, or 0 if this file has no map. The offset, if non-zero, should be to an offset into the data section, and the data should be in the format specified by ""map_list"" below."
	uint map_off;
	//count of strings in the string identifiers list
	uint string_ids_size;
	//"offset from the start of the file to the string identifiers list, or 0 if string_ids_size == 0 (admittedly a strange edge case). The offset, if non-zero, should be to the start of the string_ids section."
	uint string_ids_off;
	//count of elements in the type identifiers list
	uint type_ids_size;
	//"offset from the start of the file to the type identifiers list, or 0 if type_ids_size == 0 (admittedly a strange edge case). The offset, if non-zero, should be to the start of the type_ids section."
	uint type_ids_off;
	//count of elements in the prototype identifiers list
	uint proto_ids_size;
	//"offset from the start of the file to the prototype identifiers list, or 0 if proto_ids_size == 0 (admittedly a strange edge case). The offset, if non-zero, should be to the start of the proto_ids section."
	uint proto_ids_off;
	//count of elements in the field identifiers list
	uint field_ids_size;
	//"offset from the start of the file to the field identifiers list, or 0 if field_ids_size == 0. The offset, if non-zero, should be to the start of the field_ids section."
	uint field_ids_off;
	//count of elements in the method identifiers list
	uint method_ids_size;
	//"offset from the start of the file to the method identifiers list, or 0 if method_ids_size == 0. The offset, if non-zero, should be to the start of the method_ids section."
	uint method_ids_off;
	//count of elements in the class definitions list
	uint class_defs_size;
	//"offset from the start of the file to the class definitions list, or 0 if class_defs_size == 0 (admittedly a strange edge case). The offset, if non-zero, should be to the start of the class_defs section."
	uint class_defs_off;
	//Size of data section in bytes. Must be an even multiple of sizeof(uint).
	uint data_size;
	//offset from the start of the file to the start of the data section.
	uint data_off;
/*
*/
	//"magic value. See discussion above under ""DEX_FILE_MAGIC"" for more details."(= DEX_FILE_MAGIC)
	ubyte* GetMagic()
	{return magic;}
	//adler32 checksum of the rest of the file (everything but magic and this field); used to detect file corruption
	uint GetChecksum()
	{return checksum;}
	//"SHA-1 signature (hash) of the rest of the file (everything but magic, checksum, and this field); used to uniquely identify files"
	ubyte* GetSignature()
	{return signature;}
	//"size of the entire file (including the header), in bytes"
	uint GetFileSize()
	{return file_size;}
	//"size of the header (this entire section), in bytes. This allows for at least a limited amount of backwards/forwards compatibility without invalidating the format."(= 0x70)
	uint GetHeaderSize()
	{return header_size;}
	//"endianness tag. See discussion above under ""ENDIAN_CONSTANT and REVERSE_ENDIAN_CONSTANT"" for more details."(= ENDIAN_CONSTANT)
	uint GetEndianTag()
	{return endian_tag;}
	//"size of the link section, or 0 if this file isn't statically linked"
	uint GetLinkSize()
	{return link_size;}
	//"offset from the start of the file to the link section, or 0 if link_size == 0. The offset, if non-zero, should be to an offset into the link_data section. The format of the data pointed at is left unspecified by this document; this header field (and the previous) are left as hooks for use by runtime implementations."
	uint GetLinkOff()
	{return link_off;}
	//"offset from the start of the file to the map item, or 0 if this file has no map. The offset, if non-zero, should be to an offset into the data section, and the data should be in the format specified by ""map_list"" below."
	uint GetMapOff()
	{return map_off;}
	//count of strings in the string identifiers list
	uint GetStringidsSize()
	{return string_ids_size;}
	//"offset from the start of the file to the string identifiers list, or 0 if string_ids_size == 0 (admittedly a strange edge case). The offset, if non-zero, should be to the start of the string_ids section."
	uint GetStringidsOff()
	{return string_ids_off;}
	//count of elements in the type identifiers list
	uint GetTypeidsSize()
	{return type_ids_size;}
	//"offset from the start of the file to the type identifiers list, or 0 if type_ids_size == 0 (admittedly a strange edge case). The offset, if non-zero, should be to the start of the type_ids section."
	uint GetTypeidsOff()
	{return type_ids_off;}
	//count of elements in the prototype identifiers list
	uint GetProtoidsSize()
	{return proto_ids_size;}
	//"offset from the start of the file to the prototype identifiers list, or 0 if proto_ids_size == 0 (admittedly a strange edge case). The offset, if non-zero, should be to the start of the proto_ids section."
	uint GetProtoidsOff()
	{return proto_ids_off;}
	//count of elements in the field identifiers list
	uint GetFieldidsSize()
	{return field_ids_size;}
	//"offset from the start of the file to the field identifiers list, or 0 if field_ids_size == 0. The offset, if non-zero, should be to the start of the field_ids section."
	uint GetFieldidsOff()
	{return field_ids_off;}
	//count of elements in the method identifiers list
	uint GetMethodidsSize()
	{return method_ids_size;}
	//"offset from the start of the file to the method identifiers list, or 0 if method_ids_size == 0. The offset, if non-zero, should be to the start of the method_ids section."
	uint GetMethodidsOff()
	{return method_ids_off;}
	//count of elements in the class definitions list
	uint GetClassdefsSize()
	{return class_defs_size;}
	//"offset from the start of the file to the class definitions list, or 0 if class_defs_size == 0 (admittedly a strange edge case). The offset, if non-zero, should be to the start of the class_defs section."
	uint GetClassdefsOff()
	{return class_defs_off;}
	//Size of data section in bytes. Must be an even multiple of sizeof(uint).
	uint GetDataSize()
	{return data_size;}
	//offset from the start of the file to the start of the data section.
	uint GetDataOff()
	{return data_off;}

	int Size();
	void print();
	int sprint(char *buffer);	
};
class CDexMapList
{


public:
	//size of the list, in entries
	uint size;
/*
	//elements of the list
	CDexMapItem list[size];
*/
	//size of the list, in entries
	uint GetSize()
	{return size;}
	//elements of the list
	CDexMapItem* GetList();

	int Size();
	void print();
	int sprint(char *buffer);	
};
class CDexMapItem
{


public:
	//type of the items; see table below
	ushort type;
	//(unused)
	ushort unused;
	//count of the number of items to be found at the indicated offset
	uint size;
	//offset from the start of the file to the items in question
	uint offset;
/*
*/
	//type of the items; see table below
	ushort GetType()
	{return type;}
	//(unused)
	ushort GetUnused()
	{return unused;}
	//count of the number of items to be found at the indicated offset
	uint GetSize()
	{return size;}
	//offset from the start of the file to the items in question
	uint GetOffset()
	{return offset;}

	int Size();
	void print();
	int sprint(char *buffer);	
};
class CDexStringidItem
{


public:
	//offset from the start of the file to the string data for this item. The offset should be to a location in the data section, and the data should be in the format specified by "string_data_item" below. There is no alignment requirement for the offset.
	uint string_data_off;
/*
*/
	//offset from the start of the file to the string data for this item. The offset should be to a location in the data section, and the data should be in the format specified by "string_data_item" below. There is no alignment requirement for the offset.
	uint GetStringdataOff()
	{return string_data_off;}

	int Size();
	void print();
	int sprint(char *buffer);	
};
class CDexStringdataItem
{

	char dummy;

public:
/*
	//size of this string, in UTF-16 code units (which is the "string length" in many systems). That is, this is the decoded length of the string. (The encoded length is implied by the position of the 0 byte.)
	CDexUleb128 utf16_size;
	//a series of MUTF-8 code units (a.k.a. octets, a.k.a. bytes) followed by a byte of value 0. See "MUTF-8 (Modified UTF-8) Encoding" above for details and discussion about the data format.
	ubyte data[utf16_size];
*/
	//size of this string, in UTF-16 code units (which is the "string length" in many systems). That is, this is the decoded length of the string. (The encoded length is implied by the position of the 0 byte.)
	unsigned int GetUtf16Size();
	//a series of MUTF-8 code units (a.k.a. octets, a.k.a. bytes) followed by a byte of value 0. See "MUTF-8 (Modified UTF-8) Encoding" above for details and discussion about the data format.
	ubyte* GetData();

	int Size();
	void print();
	int sprint(char *buffer);	
};
class CDexTypeidItem
{


public:
	//index into the string_ids list for the descriptor string of this type. The string must conform to the syntax for TypeDescriptor, defined above.
	uint descriptor_idx;
/*
*/
	//index into the string_ids list for the descriptor string of this type. The string must conform to the syntax for TypeDescriptor, defined above.
	uint GetDescriptorIdx()
	{return descriptor_idx;}

	int Size();
	void print();
	int sprint(char *buffer);	
};
class CDexProtoidItem
{


public:
	//index into the string_ids list for the short-form descriptor string of this prototype. The string must conform to the syntax for ShortyDescriptor, defined above, and must correspond to the return type and parameters of this item.
	uint shorty_idx;
	//index into the type_ids list for the return type of this prototype
	uint return_type_idx;
	//offset from the start of the file to the list of parameter types for this prototype, or 0 if this prototype has no parameters. This offset, if non-zero, should be in the data section, and the data there should be in the format specified by "type_list" below. Additionally, there should be no reference to the type void in the list.
	uint parameters_off;
/*
*/
	//index into the string_ids list for the short-form descriptor string of this prototype. The string must conform to the syntax for ShortyDescriptor, defined above, and must correspond to the return type and parameters of this item.
	uint GetShortyIdx()
	{return shorty_idx;}
	//index into the type_ids list for the return type of this prototype
	uint GetReturntypeIdx()
	{return return_type_idx;}
	//offset from the start of the file to the list of parameter types for this prototype, or 0 if this prototype has no parameters. This offset, if non-zero, should be in the data section, and the data there should be in the format specified by "type_list" below. Additionally, there should be no reference to the type void in the list.
	uint GetParametersOff()
	{return parameters_off;}

	int Size();
	void print();
	int sprint(char *buffer);	
};
class CDexFieldidItem
{


public:
	//index into the type_ids list for the definer of this field. This must be a class type, and not an array or primitive type.
	ushort class_idx;
	//index into the type_ids list for the type of this field
	ushort type_idx;
	//index into the string_ids list for the name of this field. The string must conform to the syntax for MemberName, defined above.
	uint name_idx;
/*
*/
	//index into the type_ids list for the definer of this field. This must be a class type, and not an array or primitive type.
	ushort GetClassIdx()
	{return class_idx;}
	//index into the type_ids list for the type of this field
	ushort GetTypeIdx()
	{return type_idx;}
	//index into the string_ids list for the name of this field. The string must conform to the syntax for MemberName, defined above.
	uint GetNameIdx()
	{return name_idx;}

	int Size();
	void print();
	int sprint(char *buffer);	
};
class CDexMethodidItem
{


public:
	//index into the type_ids list for the definer of this method. This must be a class or array type, and not a primitive type.
	ushort class_idx;
	//index into the proto_ids list for the prototype of this method
	ushort proto_idx;
	//index into the string_ids list for the name of this method. The string must conform to the syntax for MemberName, defined above.
	uint name_idx;
/*
*/
	//index into the type_ids list for the definer of this method. This must be a class or array type, and not a primitive type.
	ushort GetClassIdx()
	{return class_idx;}
	//index into the proto_ids list for the prototype of this method
	ushort GetProtoIdx()
	{return proto_idx;}
	//index into the string_ids list for the name of this method. The string must conform to the syntax for MemberName, defined above.
	uint GetNameIdx()
	{return name_idx;}

	int Size();
	void print();
	int sprint(char *buffer);	
};
class CDexClassdefItem
{


public:
	//index into the type_ids list for this class. This must be a class type, and not an array or primitive type.
	uint class_idx;
	//access flags for the class (public, final, etc.). See "access_flags Definitions" for details.
	uint access_flags;
	//index into the type_ids list for the superclass, or the constant value NO_INDEX if this class has no superclass (i.e., it is a root class such as Object). If present, this must be a class type, and not an array or primitive type.
	uint superclass_idx;
	//offset from the start of the file to the list of interfaces, or 0 if there are none. This offset should be in the data section, and the data there should be in the format specified by "type_list" below. Each of the elements of the list must be a class type (not an array or primitive type), and there must not be any duplicates.
	uint interfaces_off;
	//index into the string_ids list for the name of the file containing the original source for (at least most of) this class, or the special value NO_INDEX to represent a lack of this information. The debug_info_item of any given method may override this source file, but the expectation is that most classes will only come from one source file.
	uint source_file_idx;
	//offset from the start of the file to the annotations structure for this class, or 0 if there are no annotations on this class. This offset, if non-zero, should be in the data section, and the data there should be in the format specified by "annotations_directory_item" below, with all items referring to this class as the definer.
	uint annotations_off;
	//offset from the start of the file to the associated class data for this item, or 0 if there is no class data for this class. (This may be the case, for example, if this class is a marker interface.) The offset, if non-zero, should be in the data section, and the data there should be in the format specified by "class_data_item" below, with all items referring to this class as the definer.
	uint class_data_off;
	//offset from the start of the file to the list of initial values for static fields, or 0 if there are none (and all static fields are to be initialized with 0 or null). This offset should be in the data section, and the data there should be in the format specified by "encoded_array_item" below. The size of the array must be no larger than the number of static fields declared by this class, and the elements correspond to the static fields in the same order as declared in the corresponding field_list. The type of each array element must match the declared type of its corresponding field. If there are fewer elements in the array than there are static fields, then the leftover fields are initialized with a type-appropriate 0 or null.
	uint static_values_off;
/*
*/
	//index into the type_ids list for this class. This must be a class type, and not an array or primitive type.
	uint GetClassIdx()
	{return class_idx;}
	//access flags for the class (public, final, etc.). See "access_flags Definitions" for details.
	uint GetAccessFlags()
	{return access_flags;}
	//index into the type_ids list for the superclass, or the constant value NO_INDEX if this class has no superclass (i.e., it is a root class such as Object). If present, this must be a class type, and not an array or primitive type.
	uint GetSuperclassIdx()
	{return superclass_idx;}
	//offset from the start of the file to the list of interfaces, or 0 if there are none. This offset should be in the data section, and the data there should be in the format specified by "type_list" below. Each of the elements of the list must be a class type (not an array or primitive type), and there must not be any duplicates.
	uint GetInterfacesOff()
	{return interfaces_off;}
	//index into the string_ids list for the name of the file containing the original source for (at least most of) this class, or the special value NO_INDEX to represent a lack of this information. The debug_info_item of any given method may override this source file, but the expectation is that most classes will only come from one source file.
	uint GetSourcefileIdx()
	{return source_file_idx;}
	//offset from the start of the file to the annotations structure for this class, or 0 if there are no annotations on this class. This offset, if non-zero, should be in the data section, and the data there should be in the format specified by "annotations_directory_item" below, with all items referring to this class as the definer.
	uint GetAnnotationsOff()
	{return annotations_off;}
	//offset from the start of the file to the associated class data for this item, or 0 if there is no class data for this class. (This may be the case, for example, if this class is a marker interface.) The offset, if non-zero, should be in the data section, and the data there should be in the format specified by "class_data_item" below, with all items referring to this class as the definer.
	uint GetClassdataOff()
	{return class_data_off;}
	//offset from the start of the file to the list of initial values for static fields, or 0 if there are none (and all static fields are to be initialized with 0 or null). This offset should be in the data section, and the data there should be in the format specified by "encoded_array_item" below. The size of the array must be no larger than the number of static fields declared by this class, and the elements correspond to the static fields in the same order as declared in the corresponding field_list. The type of each array element must match the declared type of its corresponding field. If there are fewer elements in the array than there are static fields, then the leftover fields are initialized with a type-appropriate 0 or null.
	uint GetStaticvaluesOff()
	{return static_values_off;}

	int Size();
	void print();
	int sprint(char *buffer);	
};
class CDexClassdataItem
{

	char dummy;

public:
/*
	//the number of static fields defined in this item
	CDexUleb128 static_fields_size;
	//the number of instance fields defined in this item
	CDexUleb128 instance_fields_size;
	//the number of direct methods defined in this item
	CDexUleb128 direct_methods_size;
	//the number of virtual methods defined in this item
	CDexUleb128 virtual_methods_size;
	//the defined static fields, represented as a sequence of encoded elements. The fields must be sorted by field_idx in increasing order.
	CDexEncodedField static_fields[static_fields_size];
	//the defined instance fields, represented as a sequence of encoded elements. The fields must be sorted by field_idx in increasing order.
	CDexEncodedField instance_fields[instance_fields_size];
	//the defined direct (any of static, private, or constructor) methods, represented as a sequence of encoded elements. The methods must be sorted by method_idx in increasing order.
	CDexEncodedMethod direct_methods[direct_methods_size];
	//the defined virtual (none of static, private, or constructor) methods, represented as a sequence of encoded elements. This list should not include inherited methods unless overridden by the class that this item represents. The methods must be sorted by method_idx in increasing order.
	CDexEncodedMethod virtual_methods[virtual_methods_size];
*/
	//the number of static fields defined in this item
	unsigned int GetStaticfieldsSize();
	//the number of instance fields defined in this item
	unsigned int GetInstancefieldsSize();
	//the number of direct methods defined in this item
	unsigned int GetDirectmethodsSize();
	//the number of virtual methods defined in this item
	unsigned int GetVirtualmethodsSize();
	//the defined static fields, represented as a sequence of encoded elements. The fields must be sorted by field_idx in increasing order.
	CDexEncodedField* GetStaticFields();
	//the defined instance fields, represented as a sequence of encoded elements. The fields must be sorted by field_idx in increasing order.
	CDexEncodedField* GetInstanceFields();
	//the defined direct (any of static, private, or constructor) methods, represented as a sequence of encoded elements. The methods must be sorted by method_idx in increasing order.
	CDexEncodedMethod* GetDirectMethods();
	//the defined virtual (none of static, private, or constructor) methods, represented as a sequence of encoded elements. This list should not include inherited methods unless overridden by the class that this item represents. The methods must be sorted by method_idx in increasing order.
	CDexEncodedMethod* GetVirtualMethods();

	int Size();
	void print();
	int sprint(char *buffer);	
};
class CDexEncodedField
{

	char dummy;

public:
/*
	//index into the field_ids list for the identity of this field (includes the name and descriptor), represented as a difference from the index of previous element in the list. The index of the first element in a list is represented directly.
	CDexUleb128 field_idx_diff;
	//access flags for the field (public, final, etc.). See "access_flags Definitions" for details.
	CDexUleb128 access_flags;
*/
	//index into the field_ids list for the identity of this field (includes the name and descriptor), represented as a difference from the index of previous element in the list. The index of the first element in a list is represented directly.
	unsigned int GetFieldidxDiff();
	//access flags for the field (public, final, etc.). See "access_flags Definitions" for details.
	unsigned int GetAccessFlags();

	int Size();
	void print();
	int sprint(char *buffer);	
};
class CDexEncodedMethod
{

	char dummy;

public:
/*
	//index into the method_ids list for the identity of this method (includes the name and descriptor), represented as a difference from the index of previous element in the list. The index of the first element in a list is represented directly.
	CDexUleb128 method_idx_diff;
	//access flags for the method (public, final, etc.). See "access_flags Definitions" for details.
	CDexUleb128 access_flags;
	//offset from the start of the file to the code structure for this method, or 0 if this method is either abstract or native. The offset should be to a location in the data section. The format of the data is specified by "code_item" below.
	CDexUleb128 code_off;
*/
	//index into the method_ids list for the identity of this method (includes the name and descriptor), represented as a difference from the index of previous element in the list. The index of the first element in a list is represented directly.
	unsigned int GetMethodidxDiff();
	//access flags for the method (public, final, etc.). See "access_flags Definitions" for details.
	unsigned int GetAccessFlags();
	//offset from the start of the file to the code structure for this method, or 0 if this method is either abstract or native. The offset should be to a location in the data section. The format of the data is specified by "code_item" below.
	unsigned int GetCodeOff();

	int Size();
	void print();
	int sprint(char *buffer);	
};
class CDexTypeList
{


public:
	//size of the list, in entries
	uint size;
/*
	//elements of the list
	CDexTypeItem list[size];
*/
	//size of the list, in entries
	uint GetSize()
	{return size;}
	//elements of the list
	CDexTypeItem* GetList();

	int Size();
	void print();
	int sprint(char *buffer);	
};
class CDexTypeItem
{


public:
	//index into the type_ids list
	ushort type_idx;
/*
*/
	//index into the type_ids list
	ushort GetTypeIdx()
	{return type_idx;}

	int Size();
	void print();
	int sprint(char *buffer);	
};
class CDexCodeItem
{


public:
	//the number of registers used by this code
	ushort registers_size;
	//the number of words of incoming arguments to the method that this code is for
	ushort ins_size;
	//the number of words of outgoing argument space required by this code for method invocation
	ushort outs_size;
	//the number of try_items for this instance. If non-zero, then these appear as the tries array just after the insns in this instance.
	ushort tries_size;
	//offset from the start of the file to the debug info (line numbers + local variable info) sequence for this code, or 0 if there simply is no information. The offset, if non-zero, should be to a location in the data section. The format of the data is specified by "debug_info_item" below.
	uint debug_info_off;
	//size of the instructions list, in 16-bit code units
	uint insns_size;
/*
	//actual array of bytecode. The format of code in an insns array is specified by the companion document "Bytecode for the Dalvik VM". Note that though this is defined as an array of ushort, there are some internal structures that prefer four-byte alignment. Also, if this happens to be in an endian-swapped file, then the swapping is only done on individual ushorts and not on the larger internal structures.
	ushort insns[insns_size];
	//two bytes of padding to make tries four-byte aligned. This element is only present if tries_size is non-zero and insns_size is odd.((optional) = 0)
	ushort padding;
	//array indicating where in the code exceptions are caught and how to handle them. Elements of the array must be non-overlapping in range and in order from low to high address. This element is only present if tries_size is non-zero.((optional))
	CDexTryItem tries[tries_size];
	//bytes representing a list of lists of catch types and associated handler addresses. Each try_item has a byte-wise offset into this structure. This element is only present if tries_size is non-zero.((optional))
	CDexEncodedcatchhandlerList handlers;
*/
	//the number of registers used by this code
	ushort GetRegistersSize()
	{return registers_size;}
	//the number of words of incoming arguments to the method that this code is for
	ushort GetInsSize()
	{return ins_size;}
	//the number of words of outgoing argument space required by this code for method invocation
	ushort GetOutsSize()
	{return outs_size;}
	//the number of try_items for this instance. If non-zero, then these appear as the tries array just after the insns in this instance.
	ushort GetTriesSize()
	{return tries_size;}
	//offset from the start of the file to the debug info (line numbers + local variable info) sequence for this code, or 0 if there simply is no information. The offset, if non-zero, should be to a location in the data section. The format of the data is specified by "debug_info_item" below.
	uint GetDebuginfoOff()
	{return debug_info_off;}
	//size of the instructions list, in 16-bit code units
	uint GetInsnsSize()
	{return insns_size;}
	//actual array of bytecode. The format of code in an insns array is specified by the companion document "Bytecode for the Dalvik VM". Note that though this is defined as an array of ushort, there are some internal structures that prefer four-byte alignment. Also, if this happens to be in an endian-swapped file, then the swapping is only done on individual ushorts and not on the larger internal structures.
	ushort* GetInsns();
	//two bytes of padding to make tries four-byte aligned. This element is only present if tries_size is non-zero and insns_size is odd.((optional) = 0)
	ushort GetPadding();
	//array indicating where in the code exceptions are caught and how to handle them. Elements of the array must be non-overlapping in range and in order from low to high address. This element is only present if tries_size is non-zero.((optional))
	CDexTryItem* GetTries();
	//bytes representing a list of lists of catch types and associated handler addresses. Each try_item has a byte-wise offset into this structure. This element is only present if tries_size is non-zero.((optional))
	CDexEncodedcatchhandlerList* GetHandlers();

	int Size();
	void print();
	int sprint(char *buffer);	
};
class CDexTryItem
{


public:
	//start address of the block of code covered by this entry. The address is a count of 16-bit code units to the start of the first covered instruction.
	uint start_addr;
	//number of 16-bit code units covered by this entry. The last code unit covered (inclusive) is start_addr + insn_count - 1.
	ushort insn_count;
	//offset in bytes from the start of the associated encoded_catch_hander_list to the encoded_catch_handler for this entry. This must be an offset to the start of an encoded_catch_handler.
	ushort handler_off;
/*
*/
	//start address of the block of code covered by this entry. The address is a count of 16-bit code units to the start of the first covered instruction.
	uint GetStartAddr()
	{return start_addr;}
	//number of 16-bit code units covered by this entry. The last code unit covered (inclusive) is start_addr + insn_count - 1.
	ushort GetInsnCount()
	{return insn_count;}
	//offset in bytes from the start of the associated encoded_catch_hander_list to the encoded_catch_handler for this entry. This must be an offset to the start of an encoded_catch_handler.
	ushort GetHandlerOff()
	{return handler_off;}

	int Size();
	void print();
	int sprint(char *buffer);	
};
class CDexEncodedcatchhandlerList
{

	char dummy;

public:
/*
	//size of this list, in entries
	CDexUleb128 size;
	//actual list of handler lists, represented directly (not as offsets), and concatenated sequentially
	CDexEncodedcatchHandler list[size];
*/
	//size of this list, in entries
	unsigned int GetSize();
	//actual list of handler lists, represented directly (not as offsets), and concatenated sequentially
	CDexEncodedcatchHandler* GetList();

	int Size();
	void print();
	int sprint(char *buffer);	
};
class CDexEncodedcatchHandler
{

	char dummy;

public:
/*
	//number of catch types in this list. If non-positive, then this is the negative of the number of catch types, and the catches are followed by a catch-all handler. For example: A size of 0 means that there is a catch-all but no explicitly typed catches. A size of 2 means that there are two explicitly typed catches and no catch-all. And a size of -1 means that there is one typed catch along with a catch-all.
	CDexSleb128 size;
	//stream of abs(size) encoded items, one for each caught type, in the order that the types should be tested.
	CDexEncodedtypeaddrPair handlers[abs(size)];
	//bytecode address of the catch-all handler. This element is only present if size is non-positive.((optional))
	CDexUleb128 catch_all_addr;
*/
	//number of catch types in this list. If non-positive, then this is the negative of the number of catch types, and the catches are followed by a catch-all handler. For example: A size of 0 means that there is a catch-all but no explicitly typed catches. A size of 2 means that there are two explicitly typed catches and no catch-all. And a size of -1 means that there is one typed catch along with a catch-all.
	int GetSize();
	//stream of abs(size) encoded items, one for each caught type, in the order that the types should be tested.
	CDexEncodedtypeaddrPair* GetHandlers();
	//bytecode address of the catch-all handler. This element is only present if size is non-positive.((optional))
	unsigned int GetCatchallAddr();

	int Size();
	void print();
	int sprint(char *buffer);	
};
class CDexEncodedtypeaddrPair
{

	char dummy;

public:
/*
	//index into the type_ids list for the type of the exception to catch
	CDexUleb128 type_idx;
	//bytecode address of the associated exception handler
	CDexUleb128 addr;
*/
	//index into the type_ids list for the type of the exception to catch
	unsigned int GetTypeIdx();
	//bytecode address of the associated exception handler
	unsigned int GetAddr();

	int Size();
	void print();
	int sprint(char *buffer);	
};
class CDexDebuginfoitemHeader
{

	char dummy;

public:
/*
	//the initial value for the state machine's line register. Does not represent an actual positions entry.
	CDexUleb128 line_start;
	//the number of parameter names that are encoded. There should be one per method parameter, excluding an instance method's this, if any.
	CDexUleb128 parameters_size;
	//string index of the method parameter name. An encoded value of NO_INDEX indicates that no name is available for the associated parameter. The type descriptor and signature are implied from the method descriptor and signature.
	CDexUleb128p1 parameter_names[parameters_size];
*/
	//the initial value for the state machine's line register. Does not represent an actual positions entry.
	unsigned int GetLineStart();
	//the number of parameter names that are encoded. There should be one per method parameter, excluding an instance method's this, if any.
	unsigned int GetParametersSize();
	//string index of the method parameter name. An encoded value of NO_INDEX indicates that no name is available for the associated parameter. The type descriptor and signature are implied from the method descriptor and signature.
	int* GetParameterNames();

	int Size();
	void print();
	int sprint(char *buffer);	
};
class CDexAnnotationsdirectoryItem
{


public:
	//offset from the start of the file to the annotations made directly on the class, or 0 if the class has no direct annotations. The offset, if non-zero, should be to a location in the data section. The format of the data is specified by "annotation_set_item" below.
	uint class_annotations_off;
	//count of fields annotated by this item
	uint fields_size;
	//count of methods annotated by this item
	uint methods_size;
	//count of method parameter lists annotated by this item
	uint parameters_size;
/*
	//list of associated field annotations. The elements of the list must be sorted in increasing order, by field_idx.((optional))
	CDexFieldAnnotation field_annotations[fields_size];
	//list of associated method annotations. The elements of the list must be sorted in increasing order, by method_idx.((optional))
	CDexMethodAnnotation method_annotations[methods_size];
	//list of associated method parameter annotations. The elements of the list must be sorted in increasing order, by method_idx.((optional))
	CDexParameterAnnotation parameter_annotations[parameters_size];
*/
	//offset from the start of the file to the annotations made directly on the class, or 0 if the class has no direct annotations. The offset, if non-zero, should be to a location in the data section. The format of the data is specified by "annotation_set_item" below.
	uint GetClassannotationsOff()
	{return class_annotations_off;}
	//count of fields annotated by this item
	uint GetFieldsSize()
	{return fields_size;}
	//count of methods annotated by this item
	uint GetMethodsSize()
	{return methods_size;}
	//count of method parameter lists annotated by this item
	uint GetParametersSize()
	{return parameters_size;}
	//list of associated field annotations. The elements of the list must be sorted in increasing order, by field_idx.((optional))
	CDexFieldAnnotation* GetFieldAnnotations();
	//list of associated method annotations. The elements of the list must be sorted in increasing order, by method_idx.((optional))
	CDexMethodAnnotation* GetMethodAnnotations();
	//list of associated method parameter annotations. The elements of the list must be sorted in increasing order, by method_idx.((optional))
	CDexParameterAnnotation* GetParameterAnnotations();

	int Size();
	void print();
	int sprint(char *buffer);	
};
class CDexFieldAnnotation
{


public:
	//index into the field_ids list for the identity of the field being annotated
	uint field_idx;
	//offset from the start of the file to the list of annotations for the field. The offset should be to a location in the data section. The format of the data is specified by "annotation_set_item" below.
	uint annotations_off;
/*
*/
	//index into the field_ids list for the identity of the field being annotated
	uint GetFieldIdx()
	{return field_idx;}
	//offset from the start of the file to the list of annotations for the field. The offset should be to a location in the data section. The format of the data is specified by "annotation_set_item" below.
	uint GetAnnotationsOff()
	{return annotations_off;}

	int Size();
	void print();
	int sprint(char *buffer);	
};
class CDexMethodAnnotation
{


public:
	//index into the method_ids list for the identity of the method being annotated
	uint method_idx;
	//offset from the start of the file to the list of annotations for the method. The offset should be to a location in the data section. The format of the data is specified by "annotation_set_item" below.
	uint annotations_off;
/*
*/
	//index into the method_ids list for the identity of the method being annotated
	uint GetMethodIdx()
	{return method_idx;}
	//offset from the start of the file to the list of annotations for the method. The offset should be to a location in the data section. The format of the data is specified by "annotation_set_item" below.
	uint GetAnnotationsOff()
	{return annotations_off;}

	int Size();
	void print();
	int sprint(char *buffer);	
};
class CDexParameterAnnotation
{


public:
	//index into the method_ids list for the identity of the method whose parameters are being annotated
	uint method_idx;
	//offset from the start of the file to the list of annotations for the method parameters. The offset should be to a location in the data section. The format of the data is specified by "annotation_set_ref_list" below.
	uint annotations_off;
/*
*/
	//index into the method_ids list for the identity of the method whose parameters are being annotated
	uint GetMethodIdx()
	{return method_idx;}
	//offset from the start of the file to the list of annotations for the method parameters. The offset should be to a location in the data section. The format of the data is specified by "annotation_set_ref_list" below.
	uint GetAnnotationsOff()
	{return annotations_off;}

	int Size();
	void print();
	int sprint(char *buffer);	
};
class CDexAnnotationsetrefList
{


public:
	//size of the list, in entries
	uint size;
/*
	//elements of the list
	CDexAnnotationsetrefItem list[size];
*/
	//size of the list, in entries
	uint GetSize()
	{return size;}
	//elements of the list
	CDexAnnotationsetrefItem* GetList();

	int Size();
	void print();
	int sprint(char *buffer);	
};
class CDexAnnotationsetrefItem
{


public:
	//offset from the start of the file to the referenced annotation set or 0 if there are no annotations for this element. The offset, if non-zero, should be to a location in the data section. The format of the data is specified by "annotation_set_item" below.
	uint annotations_off;
	//size of the set, in entries
	uint size;
/*
	//elements of the set. The elements must be sorted in increasing order, by type_idx.
	CDexAnnotationoffItem entries[size];
*/
	//offset from the start of the file to the referenced annotation set or 0 if there are no annotations for this element. The offset, if non-zero, should be to a location in the data section. The format of the data is specified by "annotation_set_item" below.
	uint GetAnnotationsOff()
	{return annotations_off;}
	//size of the set, in entries
	uint GetSize()
	{return size;}
	//elements of the set. The elements must be sorted in increasing order, by type_idx.
	CDexAnnotationoffItem* GetEntries();

	int Size();
	void print();
	int sprint(char *buffer);	
};
class CDexAnnotationoffItem
{


public:
	//offset from the start of the file to an annotation. The offset should be to a location in the data section, and the format of the data at that location is specified by "annotation_item" below.
	uint annotation_off;
/*
*/
	//offset from the start of the file to an annotation. The offset should be to a location in the data section, and the format of the data at that location is specified by "annotation_item" below.
	uint GetAnnotationOff()
	{return annotation_off;}

	int Size();
	void print();
	int sprint(char *buffer);	
};
class CDexAnnotationItem
{


public:
	//intended visibility of this annotation (see below)
	ubyte visibility;
/*
	//encoded annotation contents, in the format described by "encoded_annotation Format" under "encoded_value Encoding" above.
	CDexEncodedAnnotation annotation;
*/
	//intended visibility of this annotation (see below)
	ubyte GetVisibility()
	{return visibility;}
	//encoded annotation contents, in the format described by "encoded_annotation Format" under "encoded_value Encoding" above.
	CDexEncodedAnnotation* GetAnnotation();

	int Size();
	void print();
	int sprint(char *buffer);	
};
class CDexEncodedarrayItem
{

	char dummy;

public:
/*
	//bytes representing the encoded array value, in the format specified by "encoded_array Format" under "encoded_value Encoding" above.
	CDexEncodedArray value;
*/
	//bytes representing the encoded array value, in the format specified by "encoded_array Format" under "encoded_value Encoding" above.
	CDexEncodedArray* GetValue();

	int Size();
	void print();
	int sprint(char *buffer);	
};
class CDexDalvikannotationAnnotationDefault
{

	char dummy;

public:
/*
	//the default bindings for this annotation, represented as an annotation of this type. The annotation need not include all names defined by the annotation; missing names simply do not have defaults.
	CDexAnnotation value;
*/
	//the default bindings for this annotation, represented as an annotation of this type. The annotation need not include all names defined by the annotation; missing names simply do not have defaults.
	CDexAnnotation* GetValue();

	int Size();
	void print();
	int sprint(char *buffer);	
};
class CDexDalvikannotationEnclosingclass
{

	char dummy;

public:
/*
	//the class which most closely lexically scopes this class
	CDexClass value;
*/
	//the class which most closely lexically scopes this class
	CDexClass* GetValue();

	int Size();
	void print();
	int sprint(char *buffer);	
};
class CDexDalvikannotationEnclosingmethod
{

	char dummy;

public:
/*
	//the method which most closely lexically scopes this class
	CDexMethod value;
*/
	//the method which most closely lexically scopes this class
	CDexMethod* GetValue();

	int Size();
	void print();
	int sprint(char *buffer);	
};
class CDexDalvikannotationInnerclass
{

	char dummy;

public:
/*
	//the originally declared simple name of this class (not including any package prefix). If this class is anonymous, then the name is null.
	CDexString name;
	//the originally declared access flags of the class (which may differ from the effective flags because of a mismatch between the execution models of the source language and target virtual machine)
	int accessFlags;
*/
	//the originally declared simple name of this class (not including any package prefix). If this class is anonymous, then the name is null.
	CDexString* GetName();
	//the originally declared access flags of the class (which may differ from the effective flags because of a mismatch between the execution models of the source language and target virtual machine)
	int GetAccessflags();

	int Size();
	void print();
	int sprint(char *buffer);	
};
class CDexDalvikannotationMemberclasses
{

	char dummy;

public:
/*
	//array of the member classes
	CDexClass value[];
*/
	//array of the member classes
	CDexClass* GetValue();

	int Size();
	void print();
	int sprint(char *buffer);	
};
class CDexDalvikannotationSignature
{

	char dummy;

public:
/*
	//the signature of this class or member, as an array of strings that is to be concatenated together
	CDexString value[];
*/
	//the signature of this class or member, as an array of strings that is to be concatenated together
	CDexString* GetValue();

	int Size();
	void print();
	int sprint(char *buffer);	
};
class CDexDalvikannotationThrows
{

	char dummy;

public:
/*
	//the array of exception types thrown
	CDexClass value[];
*/
	//the array of exception types thrown
	CDexClass* GetValue();

	int Size();
	void print();
	int sprint(char *buffer);	
};

typedef CDexClassdefItem CDexClassDefs;
#endif// dex_structs_h
	
